package com.ssyc.gsk_parents.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.netease.nim.uikit.business.recent.RecentContactsFragment;
import com.ssyc.common.base.LazyBaseFragment;
import com.ssyc.common.utils.UiUtils;
import com.ssyc.gsk_parents.R;
import com.ssyc.gsk_parents.activity.ParentAddressBookActivity;

/**
 * 家长端消息Fragment
 * Created by Administrator on 2018/6/12 0012.
 */

public class ParentMessageFragment extends LazyBaseFragment implements View.OnClickListener {

    //通讯录
    private ImageView ivAddressBook;

    //放置云信会话列表Fragment的布局
    private LinearLayout llMessage;

    //网易云信的会话列表Framgent
    private RecentContactsFragment fragment;

    public static final String TAG = ParentMessageFragment.class.getName();


    //单例模式
    private static class LazyHolder {
        private static final ParentMessageFragment INSTANCE = new ParentMessageFragment();
    }

    public static final ParentMessageFragment newInstance() {
        return LazyHolder.INSTANCE;
    }


    @Override
    public void lazyInit(View view, Bundle savedInstanceState) {

    }

    @Override
    protected int getLayoutId() {
        return R.layout.parent_fragment_message;
    }

    @Override
    protected boolean isNeedShowTitle() {
        return false;
    }

    @Override
    protected String setTitleText() {
        return null;
    }

    @Override
    protected void init(View view, Bundle savedInstanceState) {
        super.init(view, savedInstanceState);
        showContent();

        //初始化视图
        initView(view);
    }


    /**
     * 初始化视图
     *
     * @param view
     */
    private void initView(View view) {
        ivAddressBook = view.findViewById(R.id.iv_address_book);
        ivAddressBook.setOnClickListener(this);
        llMessage = view.findViewById(R.id.ll_message);
    }

    /**
     * 点击事件
     *
     * @param view
     */
    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.iv_address_book) {
            //通讯录界面
            //跳转到通讯录界面
            UiUtils.startActivity(getContext(), ParentAddressBookActivity.class);
        }
    }

}
